package com.gofun.framework.dubbo.core.environment.config;

import com.gofun.framework.dubbo.core.environment.ConfigMapping;
import com.gofun.framework.dubbo.core.environment.ResolveMappingStrategy;
import com.gofun.framework.dubbo.core.environment.DefaultResolveStrategy.ResolveStrategyEnum;

/**
 * @Project : framework-dubbo-core
 * @Program Name :
 *          com.ljt.framework.dubbo.core.environment.property.RegistryConfigEnum
 *          .java
 * @Description : <dubbo:protocol/> 配置枚举
 * @Author : wangchao
 * @Creation Date : 2016年5月27日 下午4:14:09
 * @ModificationHistory Who When What ---------- -------------
 *                      ----------------------------------- wangchao 2016年5月27日
 *                      create
 */
public enum ProtocolConfigEnum implements ConfigMapping {

	NAME("dubbo.protocol.name", "声明要暴露的服务"),

	DUBBO_PORT("dubbo.protocol.dubbo.port", "声明要暴露的服务端口"),

	DUBBO_TIMEOUT("dubbo.protocol.dubbo.timeout", "超时设置"),

	DUBBO_SERIALIZATION("dubbo.protocol.dubbo.serialization", "序列化协议");

	public String code;

	public String text;

	public String[] activated;

	public ResolveMappingStrategy resolveMapping;
	
	private ProtocolConfigEnum(String code,String text) {
		this(code, text,ResolveStrategyEnum.DIRECT.resolve, ALL_ACTIVATED);
	}
	
	private ProtocolConfigEnum(String code,String text,String... activated) {
		this(code, text, ResolveStrategyEnum.DIRECT.resolve, activated);
	}
	
	private ProtocolConfigEnum(String code,String text,ResolveMappingStrategy resolveMapping,String... activated) {
		this.code = code;
		this.text = text;
		this.activated = activated;
		this.resolveMapping = resolveMapping;
	}
	
	@Override
	public ResolveMappingStrategy getResolveMapping() {
		return resolveMapping;
	}
	
	public String[] getActivated() {
		return activated;
	}

	@Override
	public String getCode() {
		return code;
	}

	@Override
	public String getText() {
		return text;
	}
}
